package cn.jltx.anima;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.AnimRes;

/**
 * @author jltxseo
 *         Created by junlintianxia on 2017/04/09.
 */

public class FragmentAnimator implements Parcelable{

    @AnimRes
    protected int enter; //打开创建时该fragment的进入动画
    @AnimRes
    protected int exit; //pop回退销毁Fragment时该Fragment的动画
    @AnimRes
    protected int popEnter; //回退方式回到该fragment的回来动画
    @AnimRes
    protected int popExit;  //打开下一个fragment时当前Fragment被隐藏的动画
    public FragmentAnimator() {
    }

    public FragmentAnimator(int enter, int exit) {
        this.enter = enter;
        this.exit = exit;
    }

    public FragmentAnimator(int enter, int exit, int popEnter, int popExit) {
        this.enter = enter;
        this.exit = exit;
        this.popEnter = popEnter;
        this.popExit = popExit;
    }

    protected FragmentAnimator(Parcel in){
        enter = in.readInt();
        exit = in.readInt();
        popEnter = in.readInt();
        popExit = in.readInt();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(enter);
        dest.writeInt(exit);
        dest.writeInt(popEnter);
        dest.writeInt(popExit);
    }

    public static final Creator<FragmentAnimator> CREATOR = new Creator<FragmentAnimator>() {
        @Override
        public FragmentAnimator createFromParcel(Parcel source) {
            return new FragmentAnimator(source);
        }

        @Override
        public FragmentAnimator[] newArray(int size) {
            return new FragmentAnimator[size];
        }
    };

    public int getEnter() {
        return enter;
    }

    public void setEnter(int enter) {
        this.enter = enter;
    }

    public int getExit() {
        return exit;
    }

    public void setExit(int exit) {
        this.exit = exit;
    }

    public int getPopEnter() {
        return popEnter;
    }

    public void setPopEnter(int popEnter) {
        this.popEnter = popEnter;
    }

    public int getPopExit() {
        return popExit;
    }

    public void setPopExit(int popExit) {
        this.popExit = popExit;
    }
}
